The online racing simulator
Searching in All forums
(951 results)
Cruise-script , what is needed and what would be nice to have?
Yisc[NL]
S3 licensed
There are often questions about cruise-scripts and I think there are a few Lapper-scripts out there already, but what if I would take a blank piece of paper and would start drawing a cruise-script from the ground up.
Only limitations are that Lapper must be able handle handle the desired things.
Since I am not cruising myself, I am asking the (cruising) community:

- What are the things a Cruise-script MUST have?
- What are the things that would be nice to have?

To make absolutely sure, I am not making any promises I am going to build such script and even if I would start it, no promises to finishes it at some point.
The reason for that is my current personal situation (I don't want to explain that any further), but getting to start such script, might be giving me a chance to get back up.
So, drop in your ideas/wishes (in English of course) and we will see what might come off it.
Any posts that are (partly) unrelated to my request, will be removed in order to keep this thread as clean as possible.
Yisc[NL]
S3 licensed
Maybe I am not understanding the request, but why would you want such function?
I mean, it's very easy to user either a GlobalVar or a PlayerVar to act like a switch that decides if a sub is or isn't executed.
Yisc[NL]
S3 licensed
Being a localhost, you can't kick or ban your self.
Yisc[NL]
S3 licensed
It's just a minor detail but IPAdress should be IPAddress (double D and double SS) in the English language.
Yisc[NL]
S3 licensed
Quote from Stakikety :I tried, unfortunately did not work . I think the problem , Can not pull ip address from list

Sorry, I did the code from the head and hadn't tested it.
This should work:


Event OnNewPlayerJoin( $userName )
$userName = GetCurrentPlayerVar( "UserName" );
UserGroupFromFile( "IPAddress", "./Blacklist.txt" );

IF ( UserInGroup( "IPAddress",$userName ) == 1 )
THEN
cmdLFS("/kick " . GetCurrentPlayerVar("userName") );
ENDIF
EndEvent

I just realised that above code will check if the userName is in the Blacklist.txt , while you want to check the IPAdress.
So here's another piece of code to do just that:


Event OnNewPlayerJoin( $userName )
$IPAddress = GetCurrentPlayerVar( "IPAdress" );
UserGroupFromFile( "IPAddress", "./Blacklist.txt" );

IF ( UserInGroup( "IPAdress",$IPAddress ) == 1 )
THEN
cmdLFS("/kick " . GetCurrentPlayerVar("userName") );
ENDIF
EndEvent

Last edited by Yisc[NL], .
Yisc[NL]
S3 licensed
I think it must be like this:

Event OnNewPlayerJoin( $userName )
UserInGroup( "IPAdress", "./Blacklist.txt" );

IF (UserInGroup( GetCurrentPlayerVar("IPAdress") == 1)
THEN
cmdLFS("/kick " . GetCurrentPlayerVar("userName") );
ENDIF
EndEvent

Yisc[NL]
S3 licensed
Quote from Popughini :Why do you help a demo user using Crack to have S2 license for free?

This section is about Lapper and when someone asks a question about that, they will get a proper answer.
It's not up to me to judge what someone is doing with Lapper.
We are here to help people as long as they are polite and show that they are making an effort themselfs.
To avoid further discussion about this, I'm closing this thread as the question that's been asked, has been answered.
Yisc[NL]
S3 licensed
The answer you are looking for is in the releasenotes of the latest versions of Lapper:

NOTE: Since Version 7.0.4.4 contains changes for the RegisterNodeAction() & RegisterZoneAction() Sub Callbacks. The Sub callback requires now 2 values. See example below!!

RegisterNodeAction( TESTID, getLapperVar( "ShortTrackName" ) , getCurrentPlayerVar("CurrNode") , test,"" );

Sub test($UserName,$ZoneID)
privmsg("ID=".$ZoneID); #output is TESTID
EndSub

Yisc[NL]
S3 licensed
The code below can be used in a seperate Lapper module (see included file) and will save the IP Adress of a player when he joins the track.
As you can see, there are two ways of getting the IPAdress, by either using the CurrentPlayer variable as well as reading any players variable using PlayerVar combined with the username.
The screenshot is to proof that the data is actualy stored in the Lapper database.

CatchEvent OnNewPlayerJoin( $userName ) # Player event
OnNewPlayerJoin_IP_Saving();
EndCatchEvent

Sub OnNewPlayerJoin_IP_Saving()
$userName = GetCurrentPlayerVar( "UserName" );
PrivMsg ("^7DEBUG 1: " . GetPlayerVar($userName,"IPAdress") );
PrivMsg ("^7DEBUG 2: " . GetCurrentPlayerVar( "IPAdress" ) );
SetStoredValue( $userName . "IPAdress", GetPlayerVar( $userName,"IPAdress" ) );
#SetStoredValue( $userName . "IPAdress", GetCurrentPlayerVar( "IPAdress" ) );
EndSub

Change the extension of the file to .lpr and add them to addonsused.lpr to be able to use it.
Yisc[NL]
S3 licensed
Haven't tested the code below (as I don't have the latest version of Lapper running on my machine, but I think it should be something like this:

Event OnConnect( $userName )
SetStoredValue( $userName . "IPAdress", GetPlayerVar($userName,"IPAdress") );
EndEvent

Yisc[NL]
S3 licensed
Your syntax is wrong, that's why IPAdress is saved as text instead of being a variable.
Last edited by Yisc[NL], .
Yisc[NL]
S3 licensed
I already made a registration system for Lapper.
This doesn't do anything with IP addresses, but if you understand the code, it wouldn't be too hard to include that.
See this posting for the actual script: https://www.lfs.net/forum/post/1921021#post1921021
Yisc[NL]
S3 licensed
globalMsg means sending a message to every player and since it is in the OnConnect event, it means that it sends a message to all connected players at the moment a new player connects.
Have a look in the Lapper section to find several scripts how to deal with saving and retrieving values.
Yisc[NL]
S3 licensed
Yes, that can be done.
Not in GripPB but in storedvalue.dbs

DriftPB = Storing driftscores (file can only be handled by Lapper it self)
GripPB = Storing laptimes (file can only be handled by Lapper it self)
storedvalue = Storing everything a user wants to store
Yisc[NL]
S3 licensed
The script Bass-Driver gave is very basic Lapper code, so why doesn't that work for you?
Do you get an error and if so, what's shown?
Yisc[NL]
S3 licensed
You could be right there sinanju.
Other way to go around that issue is to set the names you want to retrieve values from, using other events.
Yisc[NL]
S3 licensed
Pitboard - V2.12 (information screen about split times, gaps in front and behind you, ect)

Changelog:

- Renamed BL2 and BL2R to BL3 and BL3R, because rallytrack has moved to 3rd config of BL
- Added BL2, since that was added as BL config on the last LFS update

Change the extension of the file to .lpr and add them to addonsused.lpr to be able to use it.
Yisc[NL]
S3 licensed
Have a look at the code I use for my Pitboard.
This will show you the following:

Get a value from the player in front of you: GetPlayerVar( GetCurrentPlayerVar( "UNameBefore" ),"SectorSplit" . $splitnumber )

Get a value from the player behind you: GetPlayerVar( GetCurrentPlayerVar( "UNameBehind" ),"SectorSplit" . $splitnumber )
Yisc[NL]
S3 licensed
Thanks for your continued support of this great program.
Yisc[NL]
S3 licensed
Quote from Siikais1 :i think InSim.net

If you use Insim.net, your question shouldn't be in the Lapper section of this forum.
But the code you showed in your initial post, is Lapper code.
Yisc[NL]
S3 licensed
Sounds like a driftmeter, which is included as module in the Lapper download en I think there might be one or two other versions on this forum as well.
Yisc[NL]
S3 licensed
Nice work Smile
The real solution would be to add sorting of arrays to the source-code of Lapper, so you might want to look into that at some point.
Yisc[NL]
S3 licensed
I knew I had already written a sorting routine, just didn't know for which module that was, so I used the search of the Lapper sub-forum and typed: sort

Found a topic in which I presented my sessionlaps module and there it was: https://www.lfs.net/forum/post/1910499#post1910499
Then it was a quick copy/paste and voila Smile



Change the extension of the files to .lpr and add them to addonsused.lpr to be able to use it.

Can I be crowned King of the Labper Big grin (people who watch Bones will understand this)
Yisc[NL]
S3 licensed
Quote from num13er :maybe i am stupid,but i dont understand how it's work.how get all usernames from storedvalue(((

Don't be so harsh on your self.
If I'm right, you have just started coding within the Lapper environment, while I have many years of experience.

This piece of code is important in the OnLapperStart event:

$register_counter = ToNum( GetStoredValue( "REGISTER_COUNTER" ) );
IF ($register_counter == "")
THEN
$register_counter=0;
ENDIF

With that counter, which needs to get updated and written into the database, you can retrieve stored values from the database with something like this:

FOR ($i=0;$i<$register_counter;$i=$i+1)
IF (GetStoredValue( "logon_username_" . $i ) == $userName )
THEN
SetCurrentPlayerVar( "logon_code",GetStoredValue( "logon_code_" . $i ) );
SetCurrentPlayerVar( "logon_password",GetStoredValue( "logon_password_" . $i ) );
ENDIF
ENDFOR

In the database the stored values look like the attached image.
Last edited by Yisc[NL], .
Yisc[NL]
S3 licensed
You might want to have a look at the script I wrote as Registration system.
There's no need to start using the script it self, but you will find a method I came up with to retrieve values from the database without knowing all details.
FGED GREDG RDFGDR GSFDG